﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity.Framework;
using System.Data.Objects;

namespace Business.Operations
{
    public class DuyuruOperation
    {
        private static HPDMASEntities db = new HPDMASEntities();

        public DuyuruOperation()
        {

        }

        public static List<Duyuru> DuyuruGetAll()
        {
            var duyuruListesi = db.Duyuru.ToList();
            return duyuruListesi;
        }

        public static Duyuru DuyuruGetByDuyuruId(int duyuruId)
        {
            var duyuru = (from c in db.Duyuru where c.DuyuruID == duyuruId select c).First();
            return duyuru;
        }

        public static void DuyuruDelete(int duyuruId)
        {
            //db.gsp_tb_DuyuruDelete(duyuruId);
            Duyuru k = (from c in db.Duyuru where c.DuyuruID == duyuruId select c).First();
            db.DeleteObject(k);
            db.SaveChanges();
        }
    }
}
